home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / libg_261.zip / libg_261 / libg++ / etc / graph / eGetOpt.h < prev    next >
C/C++ Source or Header  |  1991-12-02  |  1KB  |  41 lines

  1. // -*- C++ -*-
  2. #ifndef eGetOpt_h
  3. #pragma interface
  4. #define eGetOpt_h 1
  5.  
  6. #include <GetOpt.h>
  7. #include <String.h>
  8.  
  9. // eGetOpt is a subclass of GetOpt which provides functions for
  10. // handling arguments to the options.
  11.  
  12. class eGetOpt : public GetOpt
  13. {
  14. public:
  15.   eGetOpt (int argc, char **argv, char *optstring) 
  16.     : GetOpt(argc,argv,optstring) {}
  17.  
  18.   // first_char returns the first character of the argument.
  19.  
  20.   int first_char () { return nargv[optind][0];};
  21.  
  22.   // next_arg looks at next argument for an interger, double or string
  23.   // depending on the type of argument given to it. If the correct type is
  24.   // found, the value is set and next_arg returns 1.  If the type is not
  25.   // correct, next_arg returns 0.
  26.   
  27.   // double arguments start with a digit, plus, minus or period.
  28.   // integer arguments start with a digit.
  29.   // String arguments have no restriction.
  30.  
  31.   // If the next argument is an integer, set the reference variable to it
  32.   // and increment the index to the options.  Return 1 if an integer is
  33.   // found, else return 0.
  34.   
  35.   int next_arg (int &i);
  36.   int next_arg (double &d);
  37.   int next_arg (String &s);
  38. };
  39.  
  40. #endif
  41.